﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.IO;
using DocumentsTagger.UI.ViewModel;

namespace DocumentsTagger.UI
{
    /// <summary>
    /// Interaction logic for ScannerOptionsWindow.xaml
    /// </summary>
    public partial class ScannerOptionsWindow : Window
    {
        private readonly ScannerOptionsViewModel r_vm = new ScannerOptionsViewModel();

        public ScannerOptionsWindow()
        {
            InitializeComponent();

            this.DataContext = r_vm;
        }

        private void TreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
        {
            TreeView tv = sender as TreeView;
            if (tv != null)
            {
                if (tv.SelectedItem is DriveInfo)
                {
                    DriveInfo di = tv.SelectedItem as DriveInfo;
                    r_vm.SelectedFileSystemDirectory = di.RootDirectory.FullName;
                    di = null;
                }

                if (tv.SelectedItem is DirectoryInfo)
                {
                    DirectoryInfo di = tv.SelectedItem as DirectoryInfo;
                    r_vm.SelectedFileSystemDirectory = di.FullName;
                    di = null;
                }
            }
            tv = null;
        }

      
    }
}
